home *** CD-ROM | disk | FTP | other *** search
- From: envbvs@epb2.lbl.gov (Brian V. Smith)
- Newsgroups: comp.sources.x
- Subject: v06i053: xfig 2.0 (part 4/7), Patch5
- Message-ID: <133694@sun.Eng.Sun.COM>
- Date: 30 Mar 90 04:33:37 GMT
- Approved: argv@sun.com
-
- Submitted-by: envbvs@epb2.lbl.gov (Brian V. Smith)
- Posting-number: Volume 6, Issue 53
- Archive-name: xfig2/patch5d
- Patch-To: xfig2: Volume 6, Issue 9-24,34-36
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 4 (of 7)."
- # Contents: line.c.diff main.c.diff ruler.c.diff
- # Wrapped by envbvs@epb2.lbl.gov on Wed Mar 28 09:04:56 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'line.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'line.c.diff'\"
- else
- echo shar: Extracting \"'line.c.diff'\" \(13070 characters\)
- sed "s/^X//" >'line.c.diff' <<'END_OF_FILE'
- X*** line.c.p5 Tue Jan 16 17:21:07 1990
- X--- line.c Tue Mar 27 13:59:00 1990
- X***************
- X*** 30,36
- X extern int latexline_mode, latexarrow_mode;
- X extern int magnet_mode, latexarrow_mode;
- X extern int autoforwardarrow_mode, autobackwardarrow_mode;
- X! extern int cur_line_style, line_thickness;
- X extern float cur_styleval;
- X extern int cur_color;
- X extern F_compound objects;
- X
- X--- 30,36 -----
- X extern int latexline_mode, latexarrow_mode;
- X extern int magnet_mode, latexarrow_mode;
- X extern int autoforwardarrow_mode, autobackwardarrow_mode;
- X! extern int line_style, line_thickness;
- X extern float cur_styleval;
- X extern int cur_color;
- X extern F_compound objects;
- X***************
- X*** 104,110
- X
- X draw_elasticline()
- X {
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X }
- X
- X freehand_elasticline(x, y)
- X
- X--- 104,111 -----
- X
- X draw_elasticline()
- X {
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y,
- X! INV_PAINT, 1, SOLID_LINE, 0.0);
- X }
- X
- X freehand_elasticline(x, y)
- X***************
- X*** 122,128
- X CURSOR c;
- X
- X latex_endpoint(fix_x, fix_y, cur_x, cur_y, &x, &y, latexarrow_mode, (magnet_mode)? 5: 1);
- X! pw_vector(canvas_pixwin, fix_x, fix_y, x, y, INV_PAINT,1);
- X c = (x == cur_x && y == cur_y)? &null_cursor: &crosshair_cursor;
- X if (c != cur_cursor) {
- X set_temp_cursor(c);
- X
- X--- 123,129 -----
- X CURSOR c;
- X
- X latex_endpoint(fix_x, fix_y, cur_x, cur_y, &x, &y, latexarrow_mode, (magnet_mode)? 5: 1);
- X! pw_vector(canvas_pixwin, fix_x, fix_y, x, y, INV_PAINT,1,SOLID_LINE, 0.0);
- X c = (x == cur_x && y == cur_y)? &null_cursor: &crosshair_cursor;
- X if (c != cur_cursor) {
- X set_temp_cursor(c);
- X***************
- X*** 143,149
- X int x, y;
- X {
- X if (x == cur_x && y == cur_y) return;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X cur_x = x;
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X
- X--- 144,150 -----
- X int x, y;
- X {
- X if (x == cur_x && y == cur_y) return;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X cur_x = x;
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X***************
- X*** 145,151
- X if (x == cur_x && y == cur_y) return;
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X cur_x = x;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X }
- X
- X
- X--- 146,152 -----
- X if (x == cur_x && y == cur_y) return;
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X cur_x = x;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X }
- X
- X***************
- X*** 153,159
- X int x, y;
- X {
- X if (x == cur_x && y == cur_y) return;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X cur_y = y;
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X
- X--- 154,160 -----
- X int x, y;
- X {
- X if (x == cur_x && y == cur_y) return;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X cur_y = y;
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X***************
- X*** 155,161
- X if (x == cur_x && y == cur_y) return;
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X cur_y = y;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X }
- X
- X
- X--- 156,162 -----
- X if (x == cur_x && y == cur_y) return;
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X cur_y = y;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X }
- X
- X***************
- X*** 163,169
- X int x, y;
- X {
- X if (x == cur_x && y == cur_y) return;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X if (abs(x - cur_x) < abs(y - cur_y)) {
- X cur_x += cur_y - y;
- X cur_y = y;
- X
- X--- 164,170 -----
- X int x, y;
- X {
- X if (x == cur_x && y == cur_y) return;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X if (abs(x - cur_x) < abs(y - cur_y)) {
- X cur_x += cur_y - y;
- X cur_y = y;
- X***************
- X*** 172,178
- X cur_y -= x - cur_x;
- X cur_x = x;
- X }
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X }
- X
- X
- X--- 173,179 -----
- X cur_y -= x - cur_x;
- X cur_x = x;
- X }
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X }
- X
- X***************
- X*** 180,186
- X int x, y;
- X {
- X if (x == cur_x && y == cur_y) return;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X if (abs(x - cur_x) < abs(y - cur_y)) {
- X cur_x += y - cur_y;
- X cur_y = y;
- X
- X--- 181,187 -----
- X int x, y;
- X {
- X if (x == cur_x && y == cur_y) return;
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X if (abs(x - cur_x) < abs(y - cur_y)) {
- X cur_x += y - cur_y;
- X cur_y = y;
- X***************
- X*** 189,195
- X cur_y += x - cur_x;
- X cur_x = x;
- X }
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X }
- X
- X
- X--- 190,196 -----
- X cur_y += x - cur_x;
- X cur_x = x;
- X }
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, INV_PAINT,1,SOLID_LINE, 0.0);
- X win_setmouseposition(canvas_swfd, cur_x, cur_y);
- X }
- X
- X***************
- X*** 251,257
- X get_intermediatepoint(x, y)
- X int x, y;
- X {
- X! draw_elasticline(); /* erase elastic line */
- X cur_x = x;
- X cur_y = y;
- X if (cur_command == F_POLYLINE || cur_command == F_POLYGON)
- X
- X--- 252,258 -----
- X get_intermediatepoint(x, y)
- X int x, y;
- X {
- X! draw_elasticline(); /* erase elastic line */
- X cur_x = x;
- X cur_y = y;
- X draw_elasticline();
- X***************
- X*** 254,264
- X draw_elasticline(); /* erase elastic line */
- X cur_x = x;
- X cur_y = y;
- X! if (cur_command == F_POLYLINE || cur_command == F_POLYGON)
- X! draw_line_segment(cur_line_style, cur_styleval, fix_x, fix_y, x, y,
- X! PAINT, line_thickness);
- X! else
- X! draw_elasticline();
- X num_point++;
- X fix_x = x;
- X fix_y = y;
- X
- X--- 255,261 -----
- X draw_elasticline(); /* erase elastic line */
- X cur_x = x;
- X cur_y = y;
- X! draw_elasticline();
- X num_point++;
- X fix_x = x;
- X fix_y = y;
- X***************
- X*** 317,325
- X return;
- X }
- X line->type = T_POLYLINE;
- X! line->style = cur_line_style;
- X! line->thickness = line_thickness;
- X! line->style_val = cur_styleval;
- X line->color = cur_color;
- X line->depth = 0;
- X line->area_fill = 0;
- X
- X--- 314,322 -----
- X return;
- X }
- X line->type = T_POLYLINE;
- X! line->style = SOLID_LINE;
- X! line->thickness = 1; /* these will be changed to final values */
- X! line->style_val = 0;
- X line->color = cur_color;
- X line->depth = 0;
- X line->area_fill = 0;
- X***************
- X*** 328,334
- X line->next = NULL;
- X line->for_arrow = NULL;
- X line->back_arrow = NULL;
- X! if (cur_command == F_POLYGON) {
- X if (num_point >= 3) {
- X line->type = T_POLYGON;
- X num_point++;
- X
- X--- 325,331 -----
- X line->next = NULL;
- X line->for_arrow = NULL;
- X line->back_arrow = NULL;
- X! if (cur_command == F_POLYGON) { /* polygon; close it off with one more point */
- X if (num_point >= 3) {
- X line->type = T_POLYGON;
- X num_point++;
- X***************
- X*** 333,343
- X line->type = T_POLYGON;
- X num_point++;
- X append_point(firstx, firsty, &cur_point);
- X! /* added 3/1/89 B.V.Smith */
- X! line->area_fill = fill_mode? cur_areafill : 0;
- X! fill_object(line,PAINT);
- X! draw_line_segment(cur_line_style, cur_styleval,
- X! firstx, firsty, fix_x, fix_y, PAINT, line_thickness);
- X }
- X }
- X else if (dot) {
- X
- X--- 330,339 -----
- X line->type = T_POLYGON;
- X num_point++;
- X append_point(firstx, firsty, &cur_point);
- X! draw_elasticline();
- X! fix_x=firstx;
- X! fix_y=firsty;
- X! draw_elasticline(); /* fix last elastic line */
- X }
- X }
- X else if (dot) { /* single point */
- X***************
- X*** 340,347
- X firstx, firsty, fix_x, fix_y, PAINT, line_thickness);
- X }
- X }
- X! else if (dot) {
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, PAINT, 1);
- X line->style = SOLID_LINE;
- X }
- X else if (num_point > 1) {
- X
- X--- 336,343 -----
- X draw_elasticline(); /* fix last elastic line */
- X }
- X }
- X! else if (dot) { /* single point */
- X! pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, PAINT, 2, SOLID_LINE, 0.0);
- X line->style = SOLID_LINE;
- X }
- X else if (num_point > 1) { /* polyline; draw any arrows */
- X***************
- X*** 344,350
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, PAINT, 1);
- X line->style = SOLID_LINE;
- X }
- X! else if (num_point > 1) {
- X if (autoforwardarrow_mode) {
- X line->for_arrow = forward_arrow();
- X for (p = line->points; p != cur_point; q = p, p = p->next);
- X
- X--- 340,346 -----
- X pw_vector(canvas_pixwin, fix_x, fix_y, cur_x, cur_y, PAINT, 2, SOLID_LINE, 0.0);
- X line->style = SOLID_LINE;
- X }
- X! else if (num_point > 1) { /* polyline; draw any arrows */
- X if (autoforwardarrow_mode) {
- X line->for_arrow = forward_arrow();
- X for (p = line->points; p != cur_point; q = p, p = p->next);
- X***************
- X*** 356,361
- X draw_arrow(p->x, p->y, firstx, firsty, line->back_arrow, PAINT);
- X }
- X }
- X clean_up();
- X set_action_object(F_CREATE, O_POLYLINE);
- X insert_line(&objects.lines, line);
- X
- X--- 352,369 -----
- X draw_arrow(p->x, p->y, firstx, firsty, line->back_arrow, PAINT);
- X }
- X }
- X+ if (!dot)
- X+ {
- X+ line->thickness = 1;
- X+ line->area_fill = 0;
- X+ draw_line(line,INV_PAINT); /* erase temporary outline */
- X+ line->thickness = line_thickness;
- X+ line->area_fill = fill_mode? cur_areafill : 0;
- X+ line->thickness = line_thickness;
- X+ line->style = line_style;
- X+ line->style_val = cur_styleval;
- X+ draw_line(line,PAINT); /* draw final */
- X+ }
- X clean_up();
- X set_action_object(F_CREATE, O_POLYLINE);
- X insert_line(&objects.lines, line);
- X***************
- X*** 391,397
- X XPoint *points;
- X GC gc;
- X
- X! if (line->area_fill == 0)
- X return;
- X
- X if (op == PAINT) /* fill */
- X
- X--- 399,405 -----
- X XPoint *points;
- X GC gc;
- X
- X! if (line->area_fill <= 0)
- X return;
- X
- X if (op == PAINT) /* fill */
- X***************
- X*** 399,404
- X else /* un-fill */
- X gc = un_fill_gc[line->area_fill-1];
- X
- X npts=0;
- X /* count number of points in this object */
- X for (pnt=line->points; pnt != NULL; pnt = pnt->next)
- X
- X--- 407,417 -----
- X else /* un-fill */
- X gc = un_fill_gc[line->area_fill-1];
- X
- X+ if (line->type == T_ARC_BOX)
- X+ {
- X+ fill_arc_box(line,gc);
- X+ return;
- X+ }
- X npts=0;
- X /* count number of points in this object */
- X for (pnt=line->points; pnt != NULL; pnt = pnt->next)
- X***************
- X*** 416,419
- X XFillPolygon(tool_d,canvas_pixwin,gc,points, npts,
- X Complex, CoordModeOrigin);
- X free(points);
- X }
- X
- X--- 429,485 -----
- X XFillPolygon(tool_d,canvas_pixwin,gc,points, npts,
- X Complex, CoordModeOrigin);
- X free(points);
- X+ }
- X+
- X+ fill_arc_box(line, gc)
- X+ F_line *line;
- X+ GC gc;
- X+ {
- X+ F_point *point;
- X+ int xmin,xmax,ymin,ymax;
- X+ int radius,diam;
- X+
- X+ point = line->points;
- X+ radius = line->pen;
- X+
- X+ xmin = xmax = point->x;
- X+ ymin = ymax = point->y;
- X+ while (point->next) /* find lower left (upper-left on screen) */
- X+ { /* and upper right (lower right on screen) */
- X+ point = point->next;
- X+ if (point->x < xmin)
- X+ xmin = point->x;
- X+ else if (point->x > xmax)
- X+ xmax = point->x;
- X+ if (point->y < ymin)
- X+ ymin = point->y;
- X+ else if (point->y > ymax)
- X+ ymax = point->y;
- X+ }
- X+
- X+ diam = 2*radius;
- X+ /* upper left */
- X+ XFillArc(tool_d, canvas_pixwin, gc, xmin, ymin,
- X+ diam, diam, 90*64, 90*64);
- X+ /* lower left */
- X+ XFillArc(tool_d, canvas_pixwin, gc, xmin, ymax-diam,
- X+ diam, diam, 180*64, 90*64);
- X+ /* lower right */
- X+ XFillArc(tool_d, canvas_pixwin, gc, xmax-diam, ymax-diam,
- X+ diam, diam, 270*64, 90*64);
- X+ /* upper right */
- X+ XFillArc(tool_d, canvas_pixwin, gc, xmax-diam, ymin,
- X+ diam, diam, 0*64, 90*64);
- X+ /* fill strip on left side between upper and lower arcs */
- X+ if (ymax-ymin-diam > 0)
- X+ XFillRectangle(tool_d, canvas_pixwin, gc, xmin, ymin+radius,
- X+ radius, ymax-ymin-diam);
- X+ /* fill middle section */
- X+ if (xmax-xmin-diam > 0)
- X+ XFillRectangle(tool_d, canvas_pixwin, gc, xmin+radius, ymin,
- X+ xmax-xmin-diam, ymax-ymin);
- X+ /* fill strip on right side between upper and lower arcs */
- X+ if (ymax-ymin-diam > 0)
- X+ XFillRectangle(tool_d, canvas_pixwin, gc, xmax-radius, ymin+radius,
- X+ radius, ymax-ymin-diam);
- X }
- END_OF_FILE
- if test 13070 -ne `wc -c <'line.c.diff'`; then
- echo shar: \"'line.c.diff'\" unpacked with wrong size!
- fi
- # end of 'line.c.diff'
- fi
- if test -f 'main.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'main.c.diff'\"
- else
- echo shar: Extracting \"'main.c.diff'\" \(11037 characters\)
- sed "s/^X//" >'main.c.diff' <<'END_OF_FILE'
- X*** main.c.p5 Tue Mar 13 10:19:02 1990
- X--- main.c Fri Mar 23 09:32:43 1990
- X***************
- X*** 25,47 ****
- X extern int SIDERULER_START;
- X extern int TOPRULER_LEFT, TOPRULER_TOP;
- X extern int TOPRULER_WIDTH, TOPRULER_HEIGHT;
- X- extern int INCHES;
- X extern (*canvas_rightbut_proc)();
- X extern set_popupmenu();
- X extern int cur_areafill;
- X- extern int landscape;
- X extern int print_landscape;
- X extern int size_button;
- X
- X #include "fig.icon.X"
- X Pixmap fig_icon;
- X- extern char *boldFont;
- X- extern char *normalFont;
- X
- X- #define SCREEN_WIDTH 1152 /* only used in Sunview */
- X- #define SCREEN_HEIGHT 900
- X- #define min(a,b) (((a) < (b)) ? (a) : (b))
- X-
- X static char tool_name[100] = " FIG : FACILITY FOR INTERACTIVE GENERATION OF FIGURES ";
- X static RECT icon_rect, tool_rect;
- X static sigwinched();
- X--- 25,39 ----
- X***************
- X*** 48,57 ****
- X
- X /************** FIG options ******************/
- X
- X! extern int DEBUG;
- X! extern int RHS_PANEL;
- X! extern int INVERSE;
- X! extern int TRACKING;
- X
- X TOOL tool;
- X int WINDOW_WIDTH, WINDOW_HEIGHT;
- X--- 40,46 ----
- X
- X /************** FIG options ******************/
- X
- X! extern appresStruct appres;
- X
- X TOOL tool;
- X int WINDOW_WIDTH, WINDOW_HEIGHT;
- X***************
- X*** 58,89 ****
- X char file_header[32] = "#FIG ";
- X static char *file = NULL;
- X
- X! static int true = True;
- X! static int false = False;
- X static int zero = 0;
- X- static float tmp_width = 0.0, tmp_height = 0.0;
- X
- X static XtResource application_resources[] = {
- X! {XtNjustify, XtCJustify, XtRBoolean, sizeof(int),
- X! (Cardinal)&RHS_PANEL, XtRBoolean, (caddr_t)&false},
- X! {"debug", "Debug", XtRBoolean, sizeof(int),
- X! (Cardinal)&DEBUG, XtRBoolean, (caddr_t)&false},
- X! {"landscape", XtCOrientation, XtRBoolean, sizeof(int),
- X! (Cardinal)&landscape, XtRBoolean, (caddr_t)&true},
- X! {XtNwidth, XtCWidth, XtRFloat, sizeof(float),
- X! (Cardinal)&tmp_width, XtRInt, (caddr_t)&zero},
- X! {XtNheight, XtCHeight, XtRFloat, sizeof(float),
- X! (Cardinal)&tmp_height, XtRInt, (caddr_t)&zero},
- X! {XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof(int),
- X! (Cardinal)&INVERSE, XtRBoolean, (caddr_t)&false},
- X! {"trackCursor", "Track", XtRBoolean, sizeof(int),
- X! (Cardinal)&TRACKING, XtRBoolean, (caddr_t)&false},
- X! {"inches", "Inches", XtRBoolean, sizeof(int),
- X! (Cardinal)&INCHES, XtRBoolean, (caddr_t)&true},
- X! {"boldFont", "BoldFont", XtRString, sizeof(caddr_t),
- X! (Cardinal)&boldFont, XtRString, (caddr_t)NULL},
- X! {"normalFont", "NormalFont", XtRString, sizeof(caddr_t),
- X! (Cardinal)&normalFont, XtRString, (caddr_t)NULL},
- X };
- X
- X static XrmOptionDescRec options[] =
- X--- 47,77 ----
- X char file_header[32] = "#FIG ";
- X static char *file = NULL;
- X
- X! static Boolean true = True;
- X! static Boolean false = False;
- X static int zero = 0;
- X
- X static XtResource application_resources[] = {
- X! {XtNjustify, XtCJustify, XtRBoolean, sizeof(Boolean),
- X! XtOffset(appresPtr, RHS_PANEL), XtRBoolean, (caddr_t)&false},
- X! {"landscape", XtCOrientation, XtRBoolean, sizeof(Boolean),
- X! XtOffset(appresPtr, landscape), XtRBoolean, (caddr_t)&true},
- X! {"debug", "Debug", XtRBoolean, sizeof(Boolean),
- X! XtOffset(appresPtr, DEBUG), XtRBoolean, (caddr_t)&false},
- X! {"pwidth", XtCWidth, XtRFloat, sizeof(float),
- X! XtOffset(appresPtr, tmp_width), XtRInt, (caddr_t)&zero},
- X! {"pheight", XtCHeight, XtRFloat, sizeof(float),
- X! XtOffset(appresPtr, tmp_height), XtRInt, (caddr_t)&zero},
- X! {XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof(Boolean),
- X! XtOffset(appresPtr, INVERSE), XtRBoolean, (caddr_t)&false},
- X! {"trackCursor", "Track", XtRBoolean, sizeof(Boolean),
- X! XtOffset(appresPtr, TRACKING), XtRBoolean, (caddr_t)&true},
- X! {"inches", "Inches", XtRBoolean, sizeof(Boolean),
- X! XtOffset(appresPtr, INCHES), XtRBoolean, (caddr_t)&true},
- X! {"boldFont", "BoldFont", XtRString, sizeof(char *),
- X! XtOffset(appresPtr, boldFont), XtRString, (caddr_t)NULL},
- X! {"normalFont", "NormalFont", XtRString, sizeof(char *),
- X! XtOffset(appresPtr, normalFont), XtRString, (caddr_t)NULL},
- X };
- X
- X static XrmOptionDescRec options[] =
- X***************
- X*** 95,102 ****
- X {"-Landscape", ".landscape", XrmoptionNoArg, "True"},
- X {"-portrait", ".landscape", XrmoptionNoArg, "False"},
- X {"-Portrait", ".landscape", XrmoptionNoArg, "False"},
- X! {"-width", ".width", XrmoptionSepArg, 0},
- X! {"-height", ".height", XrmoptionSepArg, 0},
- X {"-inverse", ".reverseVideo", XrmoptionNoArg, "True"},
- X {"-notrack", ".trackCursor", XrmoptionNoArg, "False"},
- X {"-track", ".trackCursor", XrmoptionNoArg, "True"},
- X--- 83,90 ----
- X {"-Landscape", ".landscape", XrmoptionNoArg, "True"},
- X {"-portrait", ".landscape", XrmoptionNoArg, "False"},
- X {"-Portrait", ".landscape", XrmoptionNoArg, "False"},
- X! {"-pwidth", ".pwidth", XrmoptionSepArg, 0},
- X! {"-pheight", ".pheight", XrmoptionSepArg, 0},
- X {"-inverse", ".reverseVideo", XrmoptionNoArg, "True"},
- X {"-notrack", ".trackCursor", XrmoptionNoArg, "False"},
- X {"-track", ".trackCursor", XrmoptionNoArg, "True"},
- X***************
- X*** 117,122 ****
- X--- 105,111 ----
- X {
- X { XtNcallback, (XtArgVal)callbacks },
- X { XtNinput, (XtArgVal) TRUE },
- X+ { XtNdefaultDistance, (XtArgVal) 1 },
- X };
- X
- X main(argc,argv)
- X***************
- X*** 129,134 ****
- X--- 118,124 ----
- X int ichild;
- X char tstr[10];
- X XWMHints *wmhints;
- X+ char i;
- X
- X strcat(tool_name, " V. ");
- X strcat(tool_name, FIG_VERSION);
- X***************
- X*** 144,168 ****
- X &argc, argv);
- X
- X fix_converters();
- X! XtGetApplicationResources(tool, 0, application_resources,
- X! XtNumber(application_resources), NULL, 0 );
- X! if (argc > 1)
- X! file = argv[1];
- X
- X! print_landscape = landscape; /* match print and screen format to start */
- X
- X tool_d = XtDisplay(tool);
- X tool_s = XtScreen(tool);
- X tool_sn = DefaultScreen(tool_d);
- X
- X! if( CellsOfScreen(tool_s) == 2 && INVERSE )
- X {
- X XrmValue value;
- X! XrmDatabase newdb = (XrmDatabase) 0;
- X! /* extern XrmDatabase XtDefaultDB; */
- X! extern XrmDatabase XtDatabase();
- X
- X- /* XtDefaultDB = XtDatabase(tool_d); */
- X value.size = sizeof("White");
- X value.addr = "White";
- X XrmPutResource(&newdb, "xfig*borderColor", "String",
- X--- 134,172 ----
- X &argc, argv);
- X
- X fix_converters();
- X! XtGetApplicationResources(tool, &appres, application_resources,
- X! 10, NULL, 0 );
- X!
- X! i=1;
- X! while (argc-- > 1)
- X! {
- X! if (*argv[i] != '-') /* search for non - name */
- X! {
- X! file = argv[i];
- X! break;
- X! }
- X! i++;
- X! }
- X
- X! print_landscape = appres.landscape; /* match print and screen format to start */
- X
- X tool_d = XtDisplay(tool);
- X tool_s = XtScreen(tool);
- X tool_sn = DefaultScreen(tool_d);
- X
- X! /* run synchronously for debugging */
- X!
- X! if (appres.DEBUG)
- X! {
- X! XSynchronize(tool_d, 1);
- X! fprintf(stderr,"Debug mode, running synchronously\n");
- X! }
- X!
- X! if( CellsOfScreen(tool_s) == 2 && appres.INVERSE )
- X {
- X XrmValue value;
- X! XrmDatabase newdb = (XrmDatabase) 0, old;
- X
- X value.size = sizeof("White");
- X value.addr = "White";
- X XrmPutResource(&newdb, "xfig*borderColor", "String",
- X***************
- X*** 175,182 ****
- X value.addr = "Black";
- X XrmPutResource(&newdb, "xfig*background", "String",
- X &value);
- X! /* XrmMergeDatabases(newdb, &XtDefaultDB); */
- X! XrmMergeDatabases(newdb, XtDatabase(tool_d));
- X
- X /* now set the tool part, since its already created */
- X XtSetArg(tmp_arg[0], XtNborderColor,
- X--- 179,186 ----
- X value.addr = "Black";
- X XrmPutResource(&newdb, "xfig*background", "String",
- X &value);
- X! old = XtDatabase(tool_d);
- X! XrmMergeDatabases(newdb, &old);
- X
- X /* now set the tool part, since its already created */
- X XtSetArg(tmp_arg[0], XtNborderColor,
- X***************
- X*** 205,218 ****
- X size_button = DEF_PRINTFONTSIZE;
- X
- X ICON_COLUMN = ICON_COLUMN_PORT;
- X! CANVAS_WIDTH = tmp_width * (INCHES ? PIX_PER_INCH : PIX_PER_CM);
- X! CANVAS_HEIGHT = tmp_height * (INCHES ? PIX_PER_INCH : PIX_PER_CM);
- X
- X if( CANVAS_WIDTH == 0 )
- X! CANVAS_WIDTH = landscape ? DEF_CANVAS_WIDTH_L : DEF_CANVAS_WIDTH_P;
- X
- X if( CANVAS_HEIGHT == 0 )
- X! CANVAS_HEIGHT = landscape ? DEF_CANVAS_HEIGHT_L : DEF_CANVAS_HEIGHT_P;
- X
- X
- X if( (CANVAS_HEIGHT < DEF_CANVAS_HEIGHT_P) ||
- X--- 209,222 ----
- X size_button = DEF_PRINTFONTSIZE;
- X
- X ICON_COLUMN = ICON_COLUMN_PORT;
- X! CANVAS_WIDTH = appres.tmp_width * (appres.INCHES ? PIX_PER_INCH : PIX_PER_CM);
- X! CANVAS_HEIGHT = appres.tmp_height * (appres.INCHES ? PIX_PER_INCH : PIX_PER_CM);
- X
- X if( CANVAS_WIDTH == 0 )
- X! CANVAS_WIDTH = appres.landscape ? DEF_CANVAS_WIDTH_L : DEF_CANVAS_WIDTH_P;
- X
- X if( CANVAS_HEIGHT == 0 )
- X! CANVAS_HEIGHT = appres.landscape ? DEF_CANVAS_HEIGHT_L : DEF_CANVAS_HEIGHT_P;
- X
- X
- X if( (CANVAS_HEIGHT < DEF_CANVAS_HEIGHT_P) ||
- X***************
- X*** 233,241 ****
- X children[ichild++] = panel_sw;
- X children[ichild++] = topruler_sw;
- X children[ichild++] = psfont; /* shows current printer font name */
- X children[ichild++] = canvas_sw; /* main drawing canvas */
- X children[ichild++] = msg_sw; /* message window */
- X- children[ichild++] = sideruler_sw; /* side ruler */
- X children[ichild++] = panel2_sw; /* lower button panel */
- X children[ichild++] = ind_box; /* fill/line/radius indicators */
- X
- X--- 237,245 ----
- X children[ichild++] = panel_sw;
- X children[ichild++] = topruler_sw;
- X children[ichild++] = psfont; /* shows current printer font name */
- X+ children[ichild++] = sideruler_sw; /* side ruler */
- X children[ichild++] = canvas_sw; /* main drawing canvas */
- X children[ichild++] = msg_sw; /* message window */
- X children[ichild++] = panel2_sw; /* lower button panel */
- X children[ichild++] = ind_box; /* fill/line/radius indicators */
- X
- X***************
- X*** 251,264 ****
- X wmhints->input = True;
- X XSetWMHints(tool_d, XtWindow(tool),wmhints);
- X
- X! if( RHS_PANEL ) /* side button panel is on right size */
- X {
- X XtSetArg(tmp_arg[0], XtNfromHoriz, 0);
- X XtSetArg(tmp_arg[1], XtNhorizDistance, RULER_WIDTH+2);
- X XtSetValues(topruler_sw, tmp_arg, 2);
- X XtSetArg(tmp_arg[0], XtNfromHoriz, 0);
- X XtSetArg(tmp_arg[1], XtNfromVert, topruler_sw);
- X! XtSetValues(sideruler_sw, tmp_arg, 2);
- X XtUnmanageChild(msg_sw);
- X XtSetArg(tmp_arg[0], XtNfromHoriz, sideruler_sw);
- X XtSetArg(tmp_arg[1], XtNfromVert, topruler_sw);
- X--- 255,272 ----
- X wmhints->input = True;
- X XSetWMHints(tool_d, XtWindow(tool),wmhints);
- X
- X! if( appres.RHS_PANEL ) /* side button panel is on right size */
- X {
- X XtSetArg(tmp_arg[0], XtNfromHoriz, 0);
- X XtSetArg(tmp_arg[1], XtNhorizDistance, RULER_WIDTH+2);
- X XtSetValues(topruler_sw, tmp_arg, 2);
- X+
- X XtSetArg(tmp_arg[0], XtNfromHoriz, 0);
- X XtSetArg(tmp_arg[1], XtNfromVert, topruler_sw);
- X! XtSetArg(tmp_arg[2], XtNleft, XtChainLeft); /* chain to left of form */
- X! XtSetArg(tmp_arg[3], XtNright, XtChainLeft);
- X! XtSetValues(sideruler_sw, tmp_arg, 4);
- X!
- X XtUnmanageChild(msg_sw);
- X XtSetArg(tmp_arg[0], XtNfromHoriz, sideruler_sw);
- X XtSetArg(tmp_arg[1], XtNfromVert, topruler_sw);
- END_OF_FILE
- if test 11037 -ne `wc -c <'main.c.diff'`; then
- echo shar: \"'main.c.diff'\" unpacked with wrong size!
- fi
- # end of 'main.c.diff'
- fi
- if test -f 'ruler.c.diff' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ruler.c.diff'\"
- else
- echo shar: Extracting \"'ruler.c.diff'\" \(15556 characters\)
- sed "s/^X//" >'ruler.c.diff' <<'END_OF_FILE'
- X*** ruler.c.p5 Tue Jan 16 17:21:03 1990
- X--- ruler.c Thu Mar 22 17:30:36 1990
- X***************
- X*** 13,24 ****
- X #include "font.h"
- X #include "paintop.h"
- X
- X! #define INCH_MARK 12
- X! #define HALF_MARK 11
- X! #define QUARTER_MARK 8
- X! #define SIXTEENTH_MARK 6
- X
- X- #define MARK_HT 5
- X #define TRM_WID 16
- X #define TRM_HT 8
- X #define SRM_WID 8
- X--- 13,23 ----
- X #include "font.h"
- X #include "paintop.h"
- X
- X! #define INCH_MARK 8
- X! #define HALF_MARK 8
- X! #define QUARTER_MARK 6
- X! #define SIXTEENTH_MARK 4
- X
- X #define TRM_WID 16
- X #define TRM_HT 8
- X #define SRM_WID 8
- X***************
- X*** 30,38 ****
- X extern int SIDERULER_HEIGHT, SIDERULER_START;
- X extern int TOPRULER_LEFT, TOPRULER_TOP;
- X extern null_proc();
- X! extern int RHS_PANEL;
- X! extern int TRACKING;
- X! extern int INCHES;
- X
- X static lasty = -100;
- X static lastx = -100;
- X--- 29,35 ----
- X extern int SIDERULER_HEIGHT, SIDERULER_START;
- X extern int TOPRULER_LEFT, TOPRULER_TOP;
- X extern null_proc();
- X! extern appresStruct appres;
- X
- X static lasty = -100;
- X static lastx = -100;
- X***************
- X*** 41,73 ****
- X "6", "7", "8", "9", "10", "11" };
- X static int troffx = -7, troffy = -10;
- X static char tr_marker_image[16] = {
- X! 0xFF, 0xFE, /* *************** */
- X! 0x7F, 0xFC, /* ************* */
- X! 0x3F, 0xF8, /* *********** */
- X! 0x1F, 0xF0, /* ********* */
- X! 0x0F, 0xE0, /* ******* */
- X! 0x07, 0xC0, /* ***** */
- X! 0x03, 0x80, /* *** */
- X! 0x01, 0x00 /* * */
- X };
- X static mpr_static(trm_pr, TRM_WID, TRM_HT, 1, tr_marker_image);
- X static int srroffx = 2, srroffy = -7;
- X static char srr_marker_image[16] = {
- X! 0x01, /* * */
- X! 0x03, /* ** */
- X! 0x07, /* *** */
- X! 0x0F, /* **** */
- X! 0x1F, /* ***** */
- X! 0x3F, /* ****** */
- X! 0x7F, /* ******* */
- X! 0xFF, /* ******** */
- X! 0x7F, /* ******* */
- X! 0x3F, /* ****** */
- X! 0x1F, /* ***** */
- X! 0x0F, /* **** */
- X! 0x07, /* *** */
- X! 0x03, /* ** */
- X! 0x01, /* * */
- X 0x00
- X };
- X static mpr_static(srrm_pr, SRM_WID, SRM_HT, 1, srr_marker_image);
- X--- 38,70 ----
- X "6", "7", "8", "9", "10", "11" };
- X static int troffx = -7, troffy = -10;
- X static char tr_marker_image[16] = {
- X! 0xFE, 0xFF, /* *************** */
- X! 0xFC, 0x7F, /* ************* */
- X! 0xF8, 0x3F, /* *********** */
- X! 0xF0, 0x1F, /* ********* */
- X! 0xE0, 0x0F, /* ******* */
- X! 0xC0, 0x07, /* ***** */
- X! 0x80, 0x03, /* *** */
- X! 0x00, 0x01, /* * */
- X };
- X static mpr_static(trm_pr, TRM_WID, TRM_HT, 1, tr_marker_image);
- X static int srroffx = 2, srroffy = -7;
- X static char srr_marker_image[16] = {
- X! 0x80, /* * */
- X! 0xC0, /* ** */
- X! 0xE0, /* *** */
- X! 0xF0, /* **** */
- X! 0xF8, /* ***** */
- X! 0xFC, /* ****** */
- X! 0xFE, /* ******* */
- X! 0xFF, /* ******** */
- X! 0xFE, /* ******* */
- X! 0xFC, /* ****** */
- X! 0xF8, /* ***** */
- X! 0xF0, /* **** */
- X! 0xE0, /* *** */
- X! 0xC0, /* ** */
- X! 0x80, /* * */
- X 0x00
- X };
- X static mpr_static(srrm_pr, SRM_WID, SRM_HT, 1, srr_marker_image);
- X***************
- X*** 74,94 ****
- X
- X static int srloffx = -10, srloffy = -7;
- X static char srl_marker_image[16] = {
- X! 0x80, /* * */
- X! 0xC0, /* ** */
- X! 0xE0, /* *** */
- X! 0xF0, /* **** */
- X! 0xF8, /* ***** */
- X! 0xFC, /* ****** */
- X! 0xFE, /* ******* */
- X 0xFF, /* ******** */
- X! 0xFE, /* ******* */
- X! 0xFC, /* ****** */
- X! 0xF8, /* ***** */
- X! 0xF0, /* **** */
- X! 0xE0, /* *** */
- X! 0xC0, /* ** */
- X! 0x80, /* * */
- X 0x00
- X };
- X static mpr_static(srlm_pr, SRM_WID, SRM_HT, 1, srl_marker_image);
- X--- 71,91 ----
- X
- X static int srloffx = -10, srloffy = -7;
- X static char srl_marker_image[16] = {
- X! 0x01, /* * */
- X! 0x03, /* ** */
- X! 0x07, /* *** */
- X! 0x0F, /* **** */
- X! 0x1F, /* ***** */
- X! 0x3F, /* ****** */
- X! 0x7F, /* ******* */
- X 0xFF, /* ******** */
- X! 0x7F, /* ******* */
- X! 0x3F, /* ****** */
- X! 0x1F, /* ***** */
- X! 0x0F, /* **** */
- X! 0x07, /* *** */
- X! 0x03, /* ** */
- X! 0x01, /* * */
- X 0x00
- X };
- X static mpr_static(srlm_pr, SRM_WID, SRM_HT, 1, srl_marker_image);
- X***************
- X*** 109,146 ****
- X
- X static Arg ruler_args[] =
- X {
- X! /* 0 */ { XtNx, (XtArgVal)0 },
- X! /* 1 */ { XtNy, (XtArgVal)0 },
- X! /* 2 */ { XtNwidth, (XtArgVal)0 },
- X! /* 3 */ { XtNheight, (XtArgVal)0 },
- X! /* 4 */ { XtNlabel, (XtArgVal)"" },
- X! /* 5 */ { XtNfromHoriz, (XtArgVal)NULL },
- X! /* 6 */ { XtNhorizDistance, (XtArgVal)0 },
- X! /* 7 */ { XtNfromVert, (XtArgVal)NULL },
- X! /* 8 */ { XtNvertDistance, (XtArgVal)0 },
- X! /* 9 */ { XtNresizable, (XtArgVal)FALSE },
- X! /* 10 */ { XtNtop, (XtArgVal)XtRubber },
- X! /* 11 */ { XtNbottom, (XtArgVal)XtRubber },
- X! /* 12 */ { XtNleft, (XtArgVal)XtRubber },
- X! /* 13 */ { XtNright, (XtArgVal)XtRubber },
- X };
- X
- X extern int SIDERULER_WIDTH, SIDERULER_HEIGHT;
- X extern int TOPRULER_WIDTH, TOPRULER_HEIGHT;
- X
- X! int init_sideruler(tool)
- X TOOL tool;
- X {
- X! ruler_args[2].value = SIDERULER_WIDTH = RULER_WIDTH;
- X! ruler_args[3].value = SIDERULER_HEIGHT = CANVAS_HEIGHT;
- X! ruler_args[5].value = (XtArgVal)canvas_sw;
- X! ruler_args[7].value = (XtArgVal)topruler_sw;
- X /* Place the sideruler below the topruler, next to the canvas,
- X but fixed offset from the top of the form */
- X! ruler_args[10].value = (XtArgVal)XtChainTop;
- X! ruler_args[11].value = (XtArgVal)XtRubber;
- X! ruler_args[12].value = (XtArgVal)XtRubber;
- X! ruler_args[13].value = (XtArgVal)XtRubber;
- X
- X sideruler_sw = XtCreateWidget("sruler", labelWidgetClass, tool,
- X ruler_args, XtNumber(ruler_args));
- X--- 106,142 ----
- X
- X static Arg ruler_args[] =
- X {
- X! /* 0 */ { XtNwidth, (XtArgVal) 0 },
- X! /* 1 */ { XtNheight, (XtArgVal) 0 },
- X! /* 2 */ { XtNlabel, (XtArgVal) "" },
- X! /* 3 */ { XtNfromHoriz, (XtArgVal) NULL },
- X! /* 4 */ { XtNhorizDistance, (XtArgVal) 0 },
- X! /* 5 */ { XtNfromVert, (XtArgVal) NULL },
- X! /* 6 */ { XtNvertDistance, (XtArgVal) 0 },
- X! /* 7 */ { XtNresizable, (XtArgVal) False },
- X! /* 8 */ { XtNtop, (XtArgVal) XtRubber }, /* these will be changed */
- X! /* 9 */ { XtNbottom, (XtArgVal) XtRubber },
- X! /* 10 */ { XtNleft, (XtArgVal) XtRubber },
- X! /* 11 */ { XtNright, (XtArgVal) XtRubber },
- X };
- X
- X extern int SIDERULER_WIDTH, SIDERULER_HEIGHT;
- X extern int TOPRULER_WIDTH, TOPRULER_HEIGHT;
- X
- X! int
- X! init_sideruler(tool)
- X TOOL tool;
- X {
- X! ruler_args[0].value = SIDERULER_WIDTH = RULER_WIDTH;
- X! ruler_args[1].value = SIDERULER_HEIGHT = CANVAS_HEIGHT;
- X! ruler_args[3].value = (XtArgVal) canvas_sw; /* from right edge of canvas */
- X! ruler_args[5].value = (XtArgVal) topruler_sw; /* down from top ruler */
- X /* Place the sideruler below the topruler, next to the canvas,
- X but fixed offset from the top of the form */
- X! ruler_args[8].value = (XtArgVal) XtChainTop;
- X! ruler_args[9].value = (XtArgVal) XtRubber;
- X! ruler_args[10].value = (XtArgVal) XtChainRight;
- X! ruler_args[11].value = (XtArgVal) XtChainRight;
- X
- X sideruler_sw = XtCreateWidget("sruler", labelWidgetClass, tool,
- X ruler_args, XtNumber(ruler_args));
- X***************
- X*** 152,161 ****
- X--- 148,183 ----
- X XClearWindow(tool_d, sideruler_pixwin);
- X }
- X
- X+ int
- X+ init_topruler(tool)
- X+ TOOL tool;
- X+ {
- X+ ruler_args[0].value = TOPRULER_WIDTH = CANVAS_WIDTH;; /* width */
- X+ ruler_args[1].value = TOPRULER_HEIGHT = RULER_WIDTH; /* height */
- X+ ruler_args[3].value = (XtArgVal) panel_sw;
- X+ ruler_args[5].value = (XtArgVal) NULL;
- X+ /* fix the top & bottom to the top of the form,
- X+ the left to the panel, and the right is rubber */
- X+ ruler_args[8].value = (XtArgVal) XtChainTop;
- X+ ruler_args[9].value = (XtArgVal) XtChainTop;
- X+ ruler_args[10].value = (XtArgVal) XtChainLeft;
- X+ ruler_args[11].value = (XtArgVal) XtRubber;
- X+
- X+ topruler_sw = XtCreateWidget("truler", labelWidgetClass, tool,
- X+ ruler_args, XtNumber(ruler_args));
- X+ return(1);
- X+ }
- X+
- X+ redisplay_topruler()
- X+ {
- X+ XClearWindow(tool_d, topruler_pixwin);
- X+ }
- X+
- X setup_rulers()
- X {
- X register int i, j;
- X register Pixmap p;
- X+ #define HINCH (PIX_PER_INCH / 2)
- X #define QINCH (PIX_PER_INCH / 4)
- X #define SINCH (PIX_PER_INCH / 16)
- X #define TWOMM (PIX_PER_CM / 5)
- X***************
- X*** 167,173 ****
- X { XtNbackgroundPixmap, (XtArgVal)NULL },
- X };
- X
- X! topruler_pixwin = trswfd = XtWindow(topruler_sw);
- X sideruler_pixwin = srswfd = XtWindow(sideruler_sw);
- X XDefineCursor(tool_d, trswfd, (Cursor)bull_cursor.bitmap);
- X XDefineCursor(tool_d, srswfd, (Cursor)bull_cursor.bitmap);
- X--- 189,195 ----
- X { XtNbackgroundPixmap, (XtArgVal)NULL },
- X };
- X
- X! topruler_pixwin = trswfd = XtWindow(topruler_sw);
- X sideruler_pixwin = srswfd = XtWindow(sideruler_sw);
- X XDefineCursor(tool_d, trswfd, (Cursor)bull_cursor.bitmap);
- X XDefineCursor(tool_d, srswfd, (Cursor)bull_cursor.bitmap);
- X***************
- X*** 188,206 ****
- X XSetForeground(tool_d, gc, fg);
- X
- X XDrawString(tool_d, p, gc, 2, TOPRULER_HEIGHT - INCH_MARK - 3,
- X! INCHES ? "in" : "cm", 2);
- X! if(INCHES) for (i = SINCH - 1; i <= TOPRULER_WIDTH; i += SINCH)
- X! {
- X j = i + 1;
- X if (j % PIX_PER_INCH == 0)
- X! {
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - INCH_MARK - 1);
- X sprintf(number, "%d", j / PIX_PER_INCH);
- X! XDrawString(tool_d, p, gc, i - 2,
- X TOPRULER_HEIGHT - INCH_MARK - 3, number,
- X j < PIX_PER_INCH * 10 ? 1 : 2);
- X! }
- X else if (j % QINCH == 0)
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - QUARTER_MARK - 1);
- X--- 210,232 ----
- X XSetForeground(tool_d, gc, fg);
- X
- X XDrawString(tool_d, p, gc, 2, TOPRULER_HEIGHT - INCH_MARK - 3,
- X! appres.INCHES ? "in" : "cm", 2);
- X! if(appres.INCHES)
- X! for (i = SINCH - 1; i <= TOPRULER_WIDTH; i += SINCH)
- X! {
- X j = i + 1;
- X if (j % PIX_PER_INCH == 0)
- X! {
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - INCH_MARK - 1);
- X sprintf(number, "%d", j / PIX_PER_INCH);
- X! XDrawString(tool_d, p, gc, i - 3,
- X TOPRULER_HEIGHT - INCH_MARK - 3, number,
- X j < PIX_PER_INCH * 10 ? 1 : 2);
- X! }
- X! else if (j % HINCH == 0)
- X! XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X! TOPRULER_HEIGHT - HALF_MARK - 1);
- X else if (j % QINCH == 0)
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - QUARTER_MARK - 1);
- X***************
- X*** 207,230 ****
- X else if (j % SINCH == 0)
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - SIXTEENTH_MARK - 1);
- X! }
- X! else for (i = TWOMM - 1; i <= TOPRULER_WIDTH; i++)
- X! {
- X j = i + 1;
- X if (j % PIX_PER_CM == 0)
- X! {
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - INCH_MARK - 1);
- X sprintf(number, "%d", j / PIX_PER_CM);
- X! XDrawString(tool_d, p, gc, i - 2,
- X TOPRULER_HEIGHT - INCH_MARK - 3, number,
- X j < PIX_PER_CM * 10 ? 1 : 2);
- X! }
- X else if (j % TWOMM == 0)
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - QUARTER_MARK - 1);
- X! }
- X! ruler_args[0].value = (XtArgVal)p;
- X XtSetValues(topruler_sw, ruler_args, 1);
- X
- X /* The arrows will be XORed into the rulers.
- X--- 233,257 ----
- X else if (j % SINCH == 0)
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - SIXTEENTH_MARK - 1);
- X! }
- X! else
- X! for (i = TWOMM - 1; i <= TOPRULER_WIDTH; i++)
- X! {
- X j = i + 1;
- X if (j % PIX_PER_CM == 0)
- X! {
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - INCH_MARK - 1);
- X sprintf(number, "%d", j / PIX_PER_CM);
- X! XDrawString(tool_d, p, gc, i - 3,
- X TOPRULER_HEIGHT - INCH_MARK - 3, number,
- X j < PIX_PER_CM * 10 ? 1 : 2);
- X! }
- X else if (j % TWOMM == 0)
- X XDrawLine(tool_d, p, gc, i, TOPRULER_HEIGHT - 1, i,
- X TOPRULER_HEIGHT - QUARTER_MARK - 1);
- X! }
- X! ruler_args[0].value = (XtArgVal) p;
- X XtSetValues(topruler_sw, ruler_args, 1);
- X
- X /* The arrows will be XORed into the rulers.
- X***************
- X*** 260,268 ****
- X SIDERULER_HEIGHT);
- X XSetForeground(tool_d, gc, fg);
- X
- X! if( INCHES )
- X {
- X! if( RHS_PANEL )
- X {
- X for (i = SINCH - 1; i <= SIDERULER_HEIGHT; i += SINCH)
- X {
- X--- 287,295 ----
- X SIDERULER_HEIGHT);
- X XSetForeground(tool_d, gc, fg);
- X
- X! if( appres.INCHES )
- X {
- X! if( appres.RHS_PANEL )
- X {
- X for (i = SINCH - 1; i <= SIDERULER_HEIGHT; i += SINCH)
- X {
- X***************
- X*** 311,317 ****
- X }
- X else
- X {
- X! if( RHS_PANEL )
- X {
- X for (i = TWOMM - 1; i <= SIDERULER_HEIGHT; i++)
- X {
- X--- 338,344 ----
- X }
- X else
- X {
- X! if( appres.RHS_PANEL )
- X {
- X for (i = TWOMM - 1; i <= SIDERULER_HEIGHT; i++)
- X {
- X***************
- X*** 351,357 ****
- X }
- X }
- X }
- X! ruler_args[0].value = (XtArgVal)p;
- X XtSetValues(sideruler_sw, ruler_args, 1);
- X
- X /* Colors set as above */
- X--- 378,384 ----
- X }
- X }
- X }
- X! ruler_args[0].value = (XtArgVal) p;
- X XtSetValues(sideruler_sw, ruler_args, 1);
- X
- X /* Colors set as above */
- X***************
- X*** 359,365 ****
- X XSetBackground(tool_d, gc, 0);
- X
- X /* make pixmaps for side ruler arrow */
- X! if( RHS_PANEL )
- X {
- X sidearrow_pm = XCreatePixmap(tool_d, sideruler_pixwin,
- X srlm_pr.width, srlm_pr.height,
- X--- 386,392 ----
- X XSetBackground(tool_d, gc, 0);
- X
- X /* make pixmaps for side ruler arrow */
- X! if( appres.RHS_PANEL )
- X {
- X sidearrow_pm = XCreatePixmap(tool_d, sideruler_pixwin,
- X srlm_pr.width, srlm_pr.height,
- X***************
- X*** 377,410 ****
- X }
- X }
- X
- X- int init_topruler(tool)
- X- TOOL tool;
- X- {
- X- ruler_args[2].value = TOPRULER_WIDTH = CANVAS_WIDTH;; /* width */
- X- ruler_args[3].value = TOPRULER_HEIGHT = RULER_WIDTH; /* height */
- X- ruler_args[5].value = (XtArgVal)panel_sw;
- X- ruler_args[7].value = (XtArgVal)NULL;
- X- /* fix the top & bottom to the top of the form,
- X- the left to the panel, and the right is rubber */
- X- ruler_args[10].value = (XtArgVal)XtChainTop;
- X- ruler_args[11].value = (XtArgVal)XtChainTop;
- X- ruler_args[12].value = (XtArgVal)XtChainLeft;
- X- ruler_args[13].value = (XtArgVal)XtRubber;
- X-
- X- topruler_sw = XtCreateWidget("truler", labelWidgetClass, tool,
- X- ruler_args, XtNumber(ruler_args));
- X- return(1);
- X- }
- X-
- X- redisplay_topruler()
- X- {
- X- XClearWindow(tool_d, topruler_pixwin);
- X- }
- X-
- X set_rulermark(x, y)
- X int x, y;
- X {
- X! if( TRACKING )
- X {
- X set_siderulermark(y);
- X set_toprulermark(x);
- X--- 404,413 ----
- X }
- X }
- X
- X set_rulermark(x, y)
- X int x, y;
- X {
- X! if( appres.TRACKING )
- X {
- X set_siderulermark(y);
- X set_toprulermark(x);
- X***************
- X*** 422,428 ****
- X {
- X int sy;
- X
- X! if( RHS_PANEL ) {
- X /* Because the ruler uses a background pixmap, we can win
- X here by using XClearArea to erase the old thing. */
- X XClearArea(tool_d, sideruler_pixwin,
- X--- 425,431 ----
- X {
- X int sy;
- X
- X! if( appres.RHS_PANEL ) {
- X /* Because the ruler uses a background pixmap, we can win
- X here by using XClearArea to erase the old thing. */
- X XClearArea(tool_d, sideruler_pixwin,
- END_OF_FILE
- if test 15556 -ne `wc -c <'ruler.c.diff'`; then
- echo shar: \"'ruler.c.diff'\" unpacked with wrong size!
- fi
- # end of 'ruler.c.diff'
- fi
- echo shar: End of archive 4 \(of 7\).
- cp /dev/null ark4isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 7 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- dan
- -----------------------------------------------------------
- O'Reilly && Associates
- argv@sun.com / argv@ora.com
- 632 Petaluma Ave, Sebastopol, CA 95472
- 800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
- Opinions expressed reflect those of the author only.
-